/**
 * 
 */
package com.luoran.kaka.api.wechat;

import java.util.Date;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.luoran.kaka.entity.AboutInfo;
import com.luoran.kaka.entity.BasicInfo;
import com.luoran.kaka.entity.CompanyInfo;
import com.luoran.kaka.service.IAboutInfoService;
import com.luoran.kaka.service.IBasicInfoService;
import com.luoran.kaka.service.ICompanyInfoService;

/**
 * ClassName: AboutInfoAction
 * date: 2018年12月14日 下午2:11:36
 * @author zq
 * @since JDK 1.8
 */
@Controller
@RequestMapping("/about")
public class AboutInfoAction {
	private static final Logger log = LoggerFactory.getLogger(AboutInfoAction.class);
	
	@Autowired
	IAboutInfoService aboutInfoService;
	@Autowired
	ICompanyInfoService companyInfoService;
	@Autowired
	IBasicInfoService basicInfoService;
	
	@RequestMapping("/save")
	@ResponseBody
	public JSONObject save(AboutInfo about) {
		JSONObject obj=new JSONObject();
		String aboutId = aboutInfoService.insertTemplate(about);
		if(!StringUtils.isEmpty(aboutId)) {
			log.info("新增风采成功,id:"+aboutId);
			obj.put("flag", true);
		}else {
			obj.put("flag", false);
		}
		
		return obj;
	}
	
	@RequestMapping("/save/art")
	@ResponseBody
	public JSONObject savePersonal(AboutInfo about) {
		JSONObject obj=new JSONObject();
		about.setCreatetime(new Date());
		String aboutId = aboutInfoService.insertTemplate(about);
		if(!StringUtils.isEmpty(aboutId)) {
			log.info("新增个人才艺成功,id:"+aboutId);
			obj.put("flag", true);
			obj.put("cardId", about.getBasicInfoId());
		}else {
			obj.put("flag", false);
		}
		return obj;
	}
}
